/**
 *
 * Created by Song, YeWen, 1/18/2012 5:31:45 PM
 *
 */

function validateVideoUrl(ori_url) 
{
    //FIXME:
    var fcduration = 100;
	var html = download_page(ori_url);
	var media_string = copyBetween(html, "mms://", "\r\n");
	if (media_string.length < 1)
	    return 'NotFoundVideo';
	media_string = "mms://" + media_string;

    var matches = html.match(/<title>([\s\S]*?)<\/title>/);
    if(matches){
        return 'success_title:' + encodeURIComponent(matches)
             + '\n video_urls:' + encodeURIComponent(media_string)
             + '\n seconds:' + parseInt(fcduration);
    }

	return 'error:empty_path';
}

// http://news.xinhuanet.com/video/2012-01/18/c_122599129.htm
function js_get_media_url(ori_url) 
{
	var html = download_page(ori_url);
	// mms://media.xinhuanet.com/media5/news/120118082529_liuhuan_3.wmv
	// \r = 0x0d  \n = 0x0a
	var media_string = copyBetween(html, 'mms://', '\r\n');
	if (media_string.length < 1)
	    return '';
	media_string = "mms://" + media_string;
	return media_string;
}
